<cfparam name="show_debug" default="0">

<cfparam name="page_name" default="Sales By User">
<cfparam name="row_header" default="##4F81BD">
<cfparam name="row_colors" default="##D0D8E8,##E9EDF4,##E7EBF3">
<cfparam name="date_to_view" default="#Now()#">

<!--- This is the math total sections for top left table--->
<cfparam name="person_payment" default="0">
<cfparam name="payment_type_total" default="0">

<!--- This is the math total sections for top right table--->
<cfparam name="cash_in" default="0">
<cfparam name="cash_sales" default="0">
<cfparam name="cash_change" default="0">
<cfparam name="cash_total" default="0">

<!--- This is the math total sections for bottom table--->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title><cfoutput>#page_name#</cfoutput></title>
	<style type="text/css">
	<!--
	body,td,th {
		font-family: Verdana, Arial, Helvetica, sans-serif;
		font-size: 12px;
	}
	body {
		margin-left: 0px;
		margin-top: 0px;
		margin-right: 0px;
		margin-bottom: 0px;
	}
	.style1 {font-size: 18px}
	.style2 {font-size: 9px}
	-->
	</style>
</head>

<cfquery datasource="#dsn1#" name="daily_recap_username">
	SELECT USERNAME FROM tblpayments
	WHERE REPORTDATE like '#DateFormat(date_to_view,"mm/dd/yyyy")#'
	GROUP BY USERNAME
</cfquery>

	<link rel="stylesheet" href="http://code.jquery.com/ui/1.8.18/themes/base/jquery-ui.css" type="text/css" media="all" />
	<link rel="stylesheet" href="http://static.jquery.com/ui/css/demo-docs-theme/ui.theme.css" type="text/css" media="all" />
	<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
	<script src="http://code.jquery.com/ui/1.8.18/jquery-ui.min.js" type="text/javascript"></script>
	<body>
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td colspan="3"><span class="style1"><cfoutput>#ucase(page_name)#</cfoutput>
<script>
	$(function() {
		$( "#datepicker" ).datepicker();
	});
</script>
	<input type="text" id="datepicker" value="<cfoutput>#DateFormat(date_to_view,"mm/dd/yyyy")#</cfoutput>" onchange='window.location.href="http://<cfoutput>#cgi.SERVER_NAME##CGI.SCRIPT_NAME#</cfoutput>?date_to_view=" + this.value'></span></td>
			</tr>
			<tr>
				<td width="100%" valign="top">
					<table width="100%" border="0" cellpadding="4">
						<tr bgcolor="<cfoutput>#row_header#</cfoutput>">
							<td><font style="color:#FFFFFF;font-size:12pt;font-weight: bold;">User</font></td>
							<td><font style="color:#FFFFFF;font-size:12pt;font-weight: bold;">Amount</font></td>
						</tr>
						<cfset this_row_color = 1>
						<cfoutput query = "daily_recap_username">
							<cfquery datasource="#dsn1#" name="daily_recap_this_username">
								SELECT * from tblpayments
								WHERE REPORTDATE like '#DateFormat(date_to_view,"mm/dd/yyyy")#'
								AND USERNAME = '#USERNAME#'
								order by RECEIPTNUM
							</cfquery>
							<cfloop query = "daily_recap_this_username">
								<cfset person_payment = person_payment+Amount>
							</cfloop>
							<tr bgcolor="<cfoutput>#ListGetAt(row_colors,this_row_color)#</cfoutput>">
								<td><font style="font-size:12pt;font-weight: bold;">#Username#</font></td>
								<td><font style="font-size:12pt;font-weight: bold;"><cfoutput>#DollarFormat(person_payment)#</cfoutput></font></td>
							</tr>
							<cfif this_row_color IS 1>
								<cfset this_row_color = 2>
							<cfelse>
								<cfset this_row_color = 1>
							</cfif>
							<cfloop query = "daily_recap_this_username">
								<tr bgcolor="<cfoutput>#ListGetAt(row_colors,3)#</cfoutput>">
									<td align="right"><font style="font-size:12pt;font-weight: bold;">Receipt: #RECEIPTNUM#</font></td>
									<td><font style="font-size:12pt;font-weight: bold;"><cfoutput>#DollarFormat(amount)#</cfoutput></font></td>
								</tr>
							</cfloop>
						</cfoutput>
					</table>
				</td>
			</tr>
		</table>
	</body>
</html>